<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  <link href="${ctx.resource}/css/goals.css" rel="stylesheet">
  <title>人马君</title>
</head>
<body>
  <div class="page-group">
    <div class="page page-current">
      <header class="bar bar-nav fs-header-small">
        <a onclick="window.history.back();" class="icon icon-left pull-left"></a>
        <h1 class="title">目标</h1>
      </header>
      
      <div class="bar bar-footer">
        <a class="button save-button">保存</a>
      </div>
      <div class="content edit-goals">
        <form method="POST" action="${ctx.host}/rounds/${courseRoundId}/basic-information/edit-target">
          <input type="hidden" name="_method" value="PATCH" />
          <div class="long-term-goal">
            <p class="no-margin" style="font-size: .75rem; color: #999;">远期目标</p>
            <div style="margin-top: .25rem;">希望在<input type="text" name="reachTime" value="${goal.reachTime}" style="margin-left: .25rem; border: none; border-bottom: 1px solid #333; font-size: .75rem; font-size: 600; text-align: center;" placeholder="达成时间 例：6周内">达成<br>
              <textarea name="content" style="padding: .25rem; border: 1px solid #c1c1c1; margin-top: .25rem; font-size: .75rem;" placeholder="请输入目标内容 例：减重8KG">${goal.content}</textarea>
            </div>
          </div>
          
          <div class="content-block edit-content-block" style="padding: 0; margin: .75rem 0 0;width: 27rem;">
            <div class="row no-gutter basic-item basic-header">
              <div class="item" style="width: 3rem;float:left;"></div>
              <c:forEach var="bodyDataType" items="${enums['bodyDataType']}" varStatus="varStatus">
                <div class="item" style="width: 3rem;float:left;">${bodyDataType.description}<c:if test="${not empty bodyDataType.unit}">(${bodyDataType.unit})</c:if></div>
                <input type="hidden" name="bodyDataTargets[${varStatus.index}].bodyDataType" value="${bodyDataType}"/>
              </c:forEach>
            </div>
            
            <div class="row no-gutter basic-item">
              <div class="item" style="width: 3rem;float:left;background-color: #fff;">入营时</div>
              <c:forEach var="bodyDataType" items="${enums['bodyDataType']}" varStatus="varStatus">
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bodyDataTargets[${varStatus.index}].currentValue" value="<fmt:formatNumber value='${targets[bodyDataType.alias].currentValue}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
              </c:forEach>
            </div>
            
            <c:forEach var="week" begin="1" end="${weeks}" step="1">
              <div class="row no-gutter basic-item">
                <div class="item" style="width: 3rem;float:left;background-color: #fff;">第${week}周
                  <input type="hidden" name="bwhRecords[${week-1}].week" value="${week}"/>
                </div>
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bwhRecords[${week-1}].weight" value="<fmt:formatNumber value='${bwhRecords[week].weight}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bwhRecords[${week-1}].bodyFatRate" value="<fmt:formatNumber value='${bwhRecords[week].bodyFatRate}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bwhRecords[${week-1}].skeletalMuscle" value="<fmt:formatNumber value='${bwhRecords[week].skeletalMuscle}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bwhRecords[${week-1}].bust" value="<fmt:formatNumber value='${bwhRecords[week].bust}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bwhRecords[${week-1}].arm" value="<fmt:formatNumber value='${bwhRecords[week].arm}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bwhRecords[${week-1}].waist" value="<fmt:formatNumber value='${bwhRecords[week].waist}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bwhRecords[${week-1}].hips" value="<fmt:formatNumber value='${bwhRecords[week].hips}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bwhRecords[${week-1}].thigh" value="<fmt:formatNumber value='${bwhRecords[week].thigh}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
              </div>
            </c:forEach>
            
            <div class="row no-gutter basic-item">
              <div class="item" style="width: 3rem;float:left;background-color: #fff;">${weeks}周目标</div>
              <c:forEach var="bodyDataType" items="${enums['bodyDataType']}" varStatus="varStatus">
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bodyDataTargets[${varStatus.index}].coachIdealValue" value="<fmt:formatNumber value='${targets[bodyDataType.alias].coachIdealValue}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
              </c:forEach>
            </div>
            
            <div class="row no-gutter basic-item">
              <div class="item" style="width: 3rem;float:left;background-color: #fff;">远期目标</div>
              <c:forEach var="bodyDataType" items="${enums['bodyDataType']}" varStatus="varStatus">
                <div class="item" style="width: 3rem;float:left;">
                  <input type="text" name="bodyDataTargets[${varStatus.index}].idealValue" value="<fmt:formatNumber value='${targets[bodyDataType.alias].idealValue}' minFractionDigits='0' maxFractionDigits='2'></fmt:formatNumber>" placeholder="请输入">
                </div>
              </c:forEach>
            </div>
          </div>
          <button type="submit" class="button" style="display: none;"></button>
        </form>
      </div>
    </div>
  </div>
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/basic/edit-target.js" />
  <script type="text/javascript">
    require(['page/basic/edit-target'], function(page) {
      page.init({
      weeks: ${weeks}
      })
    })
  </script>
    
</body>
</html>
            